Database exploration commands:

mysql -u mat259 -h tango.mat.ucsb.edu -D spl_all -p
show databases;
use spl_all;
show tables;
show columns from transactionsAll;

// searchin for some specific value

select title from transactionsAll where barcode ='0010053528112' limit 1;

// using 'like'

select title from transactionsAll where title like '2012%';

// Using functions:
// text functions:

select title from transactionsAll where Soundex(title) = Soundex('sap');

// date functions
select date(ckoutDateTime),title from transactionsAll where year(ckoutDateTime)=1994;

// summarizing functions

select avg(datediff(ckinDateTime,ckoutDateTime)) from transactionsAll; 

select avg(datediff(ckinDateTime,ckoutDateTime)) from transactionsAll where year(ckoutDateTime)!=1970;

// counting number of rows

select count(*) from transactionAll;



